import typescript from 'rollup-plugin-typescript2'
import copy from 'rollup-plugin-copy'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
export default [
  {
    input: 'src/index.ts',
    external: [],
    output: {
      file: 'dist/index.js', // 输出文件
      format: 'es', // 输出格式为ES模块
    },
    plugins: [
      nodeResolve({
        browser: true,
        // preferBuiltins: false,
        extensions: ['.js', '.json', '.jsx', '.vue', '.scss', '.css'],
        alias: {
          '@': '../src',
        },
      }),
      commonjs(),
      typescript(),
      copy({
        targets: [
          {
            src: './src/typings',
            dest: 'dist/',
          },
        ],
      }),
    ],
  },
]
